package com.jjyu.controller;

import com.jjyu.entity.Result;
import com.jjyu.entity.Feedback;
import com.jjyu.service.FeedbackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/feedback")
public class FeedbackController {

    @Autowired
    private FeedbackService feedbackService;

    @PostMapping("/recommendations")
    public Result submitFeedback(@RequestBody Feedback feedback) {
        boolean isSaved = feedbackService.saveFeedback(feedback);
        if (isSaved) {
            return Result.success("提交反馈成功");
        } else {
            return Result.error("提交反馈失败");
        }
    }
}